package com.zklh.leetcode.other;

/**
 * 最大升序子数组和
 *
 * @author tongnan
 * @date 2024/12/23
 */
public class Solution1800 {
    public int maxAscendingSum(int[] nums) {
        int current = 1;
        int max = nums[0];
        int total = nums[0];

        while (current < nums.length) {
            if (nums[current] > nums[current-1]) {
                total += nums[current];
            } else {
                total = nums[current];
            }
            max = Math.max(total, max);
            current++;
        }
        return max;
    }
}
